<template>
    <div>
        <table>
            <tbody>
                <tr>
                    <td>门店名称</td>
                    <td>
                        <input type="text" v-model="date.name">
                    </td>
                </tr>
                <tr>
                    <td>门店信息</td>
                    <td>
                        <input type="text" v-model="date.xing">
                    </td>
                </tr>
                <tr>
                    <td>营业时间</td>
                    <td>
                        <input type="date" v-model="date.dates">
                    </td>
                </tr>
                <tr>
                    <td>门店详情</td>
                    <td>
                        <textarea v-model="date.jieshao"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="button" value="添加" @click="add">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
const routher = useRouter();

const add=()=>{
    axios.post("https://localhost:7264/api/Member/AddMember",date.value).then(res=>{
        if(res.data>0){
            alert("添加成功")
            routher.push({path:"/Show"})
        }
        else{
            alert("添加失败")
        }
    })
}

const date=ref({
  "id": 0,
  "name": "",
  "dates": "",
  "xing": "",
  "jieshao": ""
})
</script>

<style scoped>

</style>